package com.exartisan.network;

import org.json.JSONException;
import org.json.JSONObject;

import com.loopj.android.http.RequestParams;

public class ParametersBuilder {

	public ParametersBuilder() {
		
	}
	
	public static RequestParams BuildParams(String data){
		RequestParams params = new RequestParams();
		params.put(NetworkUtility.DATA, data);
		return params;
	}
	
	public static String BuildTopEventData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.TOP_EVENT);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildNewEventData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.NEW_EVENT);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildGalleryInfoData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.GALLERY_INFO);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildDetailGalleryData(int parentType, int parrentID){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_DETAIL_GALLERY);
			data.put(NetworkUtility.PARENT_TYPE, parentType);
			data.put(NetworkUtility.PARENT_ID, parrentID);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return data.toString();
	}
	
	public static String BuildDetailEventData(String id){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.DETAIL_EVENT);
			data.put(NetworkUtility.REQUEST_ID, id);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return data.toString();
	}
	
	public static String BuildCategoryData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_CATEGORY);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildEventData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_EVENT);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildPostData(int categoryID, int postType){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_POST);
			data.put(NetworkUtility.CATEGORY_ID, categoryID);
			data.put(NetworkUtility.POST_TYPE, postType);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return data.toString();
	}
	
	public static String BuildCategoryForumData(){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_CATEGORY_FORUM);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return data.toString();
	}
	
	public static String BuildSurveyData(int eventID){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_SURVEY);
			data.put(NetworkUtility.EVENTID, eventID);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return data.toString();
	}
	
	public static String BuildSurveyContentData(int surveyID){
		JSONObject data = new JSONObject();
		try {
			data.put(NetworkUtility.HANDLE, NetworkUtility.HANDLE_QUESTION);
			data.put(NetworkUtility.SURVEY_ID, surveyID);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return data.toString();
	}
}
	
	